<?php

namespace app\agent\validate;

use think\Validate;

class ShopGoods extends Validate
{

    /**
     * 验证规则
     */
    protected $rule = [
        'goods_id' => 'number|gt:0',
        'price' => 'require',
        'market_price' => 'require',
        'cost' => 'require'
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'goods_id.gt'        => '商品未选择',
    ];

    /**
     * 字段描述
     */
    protected $field = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['goods_id', 'price', 'cost','market_price'],
    ];

    public function __construct(array $rules = [], $message = [], $field = [])
    {
        $this->field = [
            'goods_id' => '商品ID',
            'price' => '商品价格',
            'cost' => '商品成本',
        ];
        $this->message = array_merge($this->message, [

        ]);
        parent::__construct($rules, $message, $field);
    }

}
